std::atomic_flag_test_and_set

From Cppreference

Jump to: navigation, search
Defined in header <atomic>

bool atomic_flag_test_and_set( volatile std::atomic_flag* p );
(1) (since C++11)
bool atomic_flag_test_and_set( std::atomic_flag* p );
(2) (since C++11)
bool atomic_flag_test_and_set_explicit( volatile std::atomic_flag* p,
                                        std::memory_order order );
(3) (since C++11)
bool atomic_flag_test_and_set_explicit( std::atomic_flag* p,
                                        std::memory_order order );
(4) (since C++11)

Atomically changes the state of a std::atomic_flag pointed to by p to set (true) and returns the value it held before.

Contents

[edit] Parameters

p - pointer to std::atomic_flag to access
order - the memory sycnhronization ordering for this operation

[edit] Exceptions

noexcept specification:  
noexcept

  (since C++11)

[edit] Equivalent definition

[edit] See also

the lock-free boolean atomic type
(class)
atomically sets the value of the flag to false
(function)
defines memory ordering constraints for the given atomic operation
(typedef)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
In other languages